<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %> 
<!DOCTYPE html>
<html lang="zh-CN" >
<head>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>修改融资租赁公司信息</title>
<jsp:include page="../../import.jsp" flush="true" />
</head>

<body class="iframeBody">
<div class="Wrapper">
<div>
    <div>
        <div id="form1">
        	<input name="id" id="id" type="text" style="display: none;" value="${id}"/>
            <form id="formSet1">
                <table class="sq-formTable">
                    <tbody>
                        <tr>
                            <td colspan="2" class="caption"><div class="inR">基本信息
                            </div></td>
                        </tr>
                        <tr>
                            <td style="padding: 0;" colspan="2">
                                <table class="sq-formTable no-border">
                                    <tbody>
                                        <tr>
                                            <td class="tbLabel"><div class="label">隶属</div></td>
                                            <td>
                                                <div class="field">
                                                    <select name="compLvlCd" id="compLvlCd" data-value="">
                                                        <option value="${dfCompLvlCd.key }">${dfCompLvlCd.value }</option>
                                                    </select>
                                                </div>
                                            </td>
                                            <td class="tbLabel"><div class="label">中文全称</div></td>
                                            <td>
                                                <div class="field">
                                                    <input name="fulNm" id="fulNm" type="text" class="ui-textbox" value="" validate="{required:true}">
                                                </div>
                                                <span class="requiredSymbol">*</span>
                                            </td>
                                            <td class="tbLabel"><div class="label">中文简称</div></td>
                                            <td>
                                                <div class="field">
                                                    <input name="shtNm" id="shtNm" type="text" class="ui-textbox" value="" validate="{required:true}">
                                                </div>
                                                <span class="requiredSymbol">*</span>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="tbLabel"><div class="label">英文名称</div></td>
                                            <td>
                                                <div class="field">
                                                    <input name="engNm" id="engNm" type="text" class="ui-textbox" value="">
                                                </div>
                                            </td>
                                            <td class="tbLabel"><div class="label">公司隶属</div></td>
                                            <td>
                                                <div class="field">
                                                    <select name="compPropCd" id="compPropCd" data-value="">
                                                        <option value=" " seleted>请选择</option>
                                                        <c:forEach items="${searchCompPropCdList }" var="kv">
								                        	<option value="${kv.key }">${kv.value }</option>
								                        </c:forEach>
                                                    </select>
                                                </div>
                                            </td>
                                            <td class="tbLabel"><div class="label">公司性质</div></td>
                                            <td>
                                                <div class="field">
                                                    <select name="compTypCd" id="compTypCd" data-value="">
                                                        <option value=" " selected="selected">请选择</option>
                                                        <c:forEach items="${searchCompTypCdList }" var="kv">
								                        	<option value="${kv.key }">${kv.value }</option>
								                        </c:forEach>
                                                    </select>
                                                </div>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="tbLabel"><div class="label">公司规模</div></td>
                                            <td>
                                                <div class="field">
                                                    <select name="empQtyCd" id="empQtyCd" data-value="">
                                                        <option value=" " seleted>请选择</option>
                                                        <c:forEach items="${searchEmpQtyCdList }" var="kv">
								                        	<option value="${kv.key }">${kv.value }</option>
								                        </c:forEach>
                                                    </select>
                                                </div>
                                            </td>
                                            <td class="tbLabel"><div class="label">成立日期</div></td>
                                            <td>
                                                <div class="field">
                                                    <input name="regDt" id="regDt" type="text" class="ui-datepicker" value=""  disabled="disabled" >
                                                </div>
                                            </td>
                                            <td class="tbLabel"><div class="label">营业期限</div></td>
                                            <td>
                                                <div class="field">
                                                    <input name="expDt" id="expDt" type="text" class="ui-datepicker" value=""  disabled="disabled" >
                                                </div>
                                            </td>
                                        </tr>
                                        <tr>
                                          <td class="tbLabel"><div class="label">营业执照</div></td>
                                            <td>
                                                <div class="field">
                                                    <input name="bizLicNo" id="bizLicNo" type="text" class="ui-textbox" value="">
                                                </div>
                                            </td>
                                            <td class="tbLabel"><div class="label">税务登记证</div></td>
                                            <td>
                                                <div class="field">
                                                    <input name="taxRegNo" id="taxRegNo" type="text" class="ui-textbox" value="">
                                                </div>
                                            </td>
                                            <td class="tbLabel"><div class="label">组织机构代码证</div></td>
                                            <td>
                                                <div class="field">
                                                    <input name="orgCode" id="orgCode" type="text" class="ui-textbox" value="">
                                                </div>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="tbLabel"><div class="label">经营范围</div></td>
                                            <td>
                                                <div class="field">
                                                    <input name="bizScope" id="bizScope" type="text" class="ui-textbox" value="">
                                                </div>
                                            </td>
                                            <td class="tbLabel"><div class="label">注册资本(万元)</div></td>
                                            <td>
                                                <div class="field">
                                                    <input name="regCapAmt" id="regCapAmt" type="text" class="ui-textbox" value=""  validate="{number:true}">
                                                </div>
                                            </td>
                                            <td class="tbLabel"><div class="label">注册电话</div></td>
                                            <td>
                                                <div class="field">
                                                    <input name="compTel" id="compTel" type="text" class="ui-textbox" value="" >
                                                </div>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="tbLabel"><div class="label">传真</div></td>
                                            <td>
                                                <div class="field">
                                                    <input name="compTax" id="compTax" type="text" class="ui-textbox" value="">
                                                </div>
                                            </td>
                                            <td class="tbLabel"><div class="label">注册地址</div></td>
                                            <td>
                                                <div class="field">
                                                    <input name="regAddr" id="regAddr" type="text" class="ui-textbox" value="">
                                                </div>
                                            </td>
                                            <td class="tbLabel"><div class="label">实际办公地址</div></td>
                                            <td>
                                                <div class="field">
                                                    <input name="officeAddr" id="officeAddr" type="text" class="ui-textbox" value="">
                                                </div>
                                            </td>
                                       </tr>
				                        <tr>
				                            <td class="tbLabel"><div class="label">备注</div></td>
				                            <td colspan="5">
				                                <div class="field" style="width:100%">
				                                    <textarea name="compRem" id="compRem" rows="4" class="l-textarea" style="width:100%"></textarea>
				                                </div>
				                            </td>
				                         </tr>
                                    </tbody>
                                </table>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" class="caption"><div class="inR">法人/联系人信息
                            </div></td>
                        </tr>
                        <tr>
                            
                            <td style="padding: 0;">
                                <table class="sq-formTable no-border">
                                    <tbody>
                                        <tr>
                                            <td class="tbLabel noBgColor">法人姓名</td>
                                            <td>
                                                <div class="field">
                                                    <input name="repNm" id="repNm" type="text" class="ui-textbox" value="" validate="{nmcharacter:true}">
                                                </div>
                                            </td>
                                            <td class="tbLabel noBgColor">法人身份证码</td>
                                            <td>
                                                <div class="field">
                                                    <input name="repIdNum" id="repIdNum" type="text" class="ui-textbox" value="" validate="{idcardno:true}">
                                                </div>
                                            </td>
                                            <td class="tbLabel noBgColor">法人办公电话</td>
                                            <td>
                                                <div class="field">
                                                    <input name="repOfficTel" id="repOfficTel" type="text" class="ui-textbox" value="" >
                                                </div>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="tbLabel noBgColor">法人常住地址</td>
                                            <td>
                                                <div class="field">
                                                    <input name="repAddr" id="repAddr" type="text" class="ui-textbox" value="">
                                                </div>
                                            </td>
                                            <td class="tbLabel noBgColor">法人手机号码</td>
                                            <td>
                                                <div class="field">
                                                    <input name="repMp" id="repMp" type="text" class="ui-textbox" value="" validate="{mobile:true}">
                                                </div>
                                            </td>
                                           
                                        </tr>
                                        <tr>
                                            <td class="tbLabel noBgColor">联系人姓名</td>
                                            <td>
                                                <div class="field">
                                                    <input name="lmNm" id="lmNm" type="text" class="ui-textbox" value="" validate="{nmcharacter:true}">
                                                </div>
                                            </td>
                                            <td class="tbLabel noBgColor">联系人身份证码</td>
                                            <td>
                                                <div class="field">
                                                    <input name="lmIdNum" id="lmIdNum" type="text" class="ui-textbox" value="" validate="{idcardno:true}">
                                                </div>
                                            </td>
                                            
                                        </tr>
                                        <tr>
                                            <td class="tbLabel noBgColor">联系人常驻地址</td>
                                            <td>
                                                <div class="field">
                                                    <input name="lmAddr" id="lmAddr" type="text" class="ui-textbox" value="">
                                                </div>
                                            </td>
                                            <td class="tbLabel noBgColor">联系人手机号码</td>
                                            <td>
                                                <div class="field">
                                                    <input name="lmMp" id="lmMp" type="text" class="ui-textbox" value="" validate="{mobile:true}">
                                                </div>
                                            </td>
                                            
                                        </tr>
                                         <tr>
                                            <td colspan="4" align="center">
                                                <div class="btnsBox">
                                                    <span id="saveBtn1" class="sq-button sq-button-hasicon" onclick="add();"><i class="sqBtnIco_10"></i>保存</span>
                                                </div>
                                            </td>
                                        </tr>
                                        
                                    </tbody>
                                </table>
                            </td>
                        </tr>
                        
                    </tbody>
                </table>
            </form>
        </div>
    </div>
</div>
</div>

<script type="text/javascript">

$(function () {
   
    $("#formSet1").ligerForm({
        validate : true
    });
   
 	 //初始化数据
    initData();
    initEvent();
});


function initEvent(){
	
	$("#birthday").ligerDateEditor({
			format: "yyyy-MM-dd",
			labelAlign: 'center',
			cancelable : false,
			onChangeDate:function(value){
				value = value.replace(/-/g,"/") + " 00:00:00";
				var newDateYear = new Date(value).getFullYear();
				var currentYear = new Date().getFullYear();
				var age = currentYear - newDateYear;
				if(age > 0){
					$("#age").val(age);
				}else{
					$("#age").val(0);
				}
			}
	});
	
}


function initData(){
	var _id = $("#id").val();
	
	if(!_id)return;
	var _url = '<%=path%>/system/sysFlCompInfo/getById.do';
	$.ajax({
		type: 'get',
		dataType:'json',
		data:{id:_id},
		url: _url,
		success:function(msg){
			 if(msg.success == 1){
				 setData(msg.data);//设置数据
			 }else{
				 alert(msg.info);
			 }
		}
	});
}

//设置页面数据
function setData(data){
	
	var form = new liger.get("formSet1");
	form.setData({
		compPropCd:data.compPropCd,
		compTypCd:data.compTypCd,
		empQtyCd:data.empQtyCd,
		
	});
	$("#fulNm").val(data.fulNm);
	$("#shtNm").val(data.shtNm);
	$("#engNm").val(data.engNm);
	$("#bizLicNo").val(data.bizLicNo);
	$("#taxRegNo").val(data.taxRegNo);
	$("#orgCode").val(data.orgCode);
	$("#bizScope").val(data.bizScope);
	$("#regCapAmt").val(data.regCapAmt);
	$("#compTel").val(data.compTel);
	$("#compTax").val(data.compTax);
	$("#regAddr").val(data.regAddr);
	$("#officeAddr").val(data.officeAddr);
	$("#compRem").val(data.compRem);
	$("#repNm").val(data.repNm);
	$("#repIdNum").val(data.repIdNum);
	$("#repOfficTel").val(data.repOfficTel);
	$("#repAddr").val(data.repAddr);
	$("#repMp").val(data.repMp);
	$("#lmNm").val(data.lmNm);
	$("#lmIdNum").val(data.lmIdNum);
	$("#lmAddr").val(data.lmAddr);
	$("#lmMp").val(data.lmMp);
	if(data.regDt){
		var date = new Date(data.regDt);
		var dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DD);
		$("#regDt").val(dateStr);
	}
	if(data.expDt){
		var date = new Date(data.expDt);
		var dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DD);
		$("#expDt").val(dateStr);
	}
}

//新增
function add(){
	var form = new liger.get("formSet1");
    var data = form.getData();
    data["regDt"] = $("#regDt").val();
    data["expDt"] = $("#expDt").val();
    var url = '<%=path%>/system/sysFlCompInfo/add.do';
    var id = $("#id").val();
    if(id != ""){
    	url = '<%=path%>/system/sysFlCompInfo/modify.do';
    	data["id"]= id;
    }
    $.ajax({
		type: 'post',
		dataType:'json',
		data:data,
		url: url,
		success:function(msg){
			 if(msg.success == 1){
				 $.ligerDialog.success(msg.info);
				 if(msg.data){
					 $("#id").val(msg.data);
				 }
			 }else{
				 top.$.ligerDialog.SQalert({content: msg.info,SQ_type: "error"});
			 }
		}
	});
}


</script>


</body>
</html>
